#ifndef _MOTOR_H
#define _MOTOR_H

#include <avr/io.h>
#include <avr/interrupt.h>
#include "led.h"
#include <math.h>


#define PWM_32KHZ_PHASE  // Resolution 8 bit for PWM

#define N_SIN 256

#define PWM_A_MOTOR0 OCR0A
#define PWM_B_MOTOR0 OCR0B
#define PWM_C_MOTOR0 OCR2B

extern volatile uint8_t sin_tab[N_SIN];
extern uint8_t mot_A,mot_B,mot_C;

void motor_control_init(void); 
void calc_sinus_tab(uint8_t max_pwm);
void calc_tab(void);
void motor_position(int motor_pos);
uint8_t get_sin_value( uint16_t pos);

#endif
